import os
import json
from flask import Flask
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy import (create_engine, MetaData, Column, Integer, String)
from sqlalchemy import func
from sqlalchemy.sql.expression import and_, or_
from sqlalchemy import Table, Column, Integer, String, Text, DateTime, MetaData, ForeignKey, Boolean, types, Numeric
from datetime import datetime, date,time
from sqlca import get_Session

import sys
reload(sys)
sys.setdefaultencoding('utf8')
 
Base = declarative_base()



class card_app_log(Base):
    __tablename__ = 'card_app_log'
    d_retail_time = Column(String(20),primary_key=True)
    c_pos_id =Column(String(200))
    msg = Column(String(2000),primary_key=True)
    c_type = Column(String(20))


def app_log(as_msg,as_type):
    return
    session = get_Session()()
    dt = session.execute("select to_char(sysdate ,'yyyy-mm-dd hh:mm:ss') from DUAL").first()[0]
    card_app_log2 = card_app_log(d_retail_time = dt,msg = as_msg,c_type = as_type)
    session.add(card_app_log2)
    session.flush()
    session.commit()
    session.close()



# app_log('2222','http://gsisvn.oicp.net:5000/v1.0/confirm/req_type=pay&posno=99999&\
# 	old_bill =*&Key=867<25626<$53=34=2:.9213-70035&money=12&Track1=sfssdfssdfsf&track2=7181015575&track3=34343434','input')    
